﻿using MagicWorld.DDD.Domain.Types;

namespace MagicWorld.DDD.Domain.Entity
{
    public class Weapon
    {
        public WeaponId Id { get; private set; }
        public string Name { get; private set; }
        public WeaponType WeaponType { get; private set; }
        public long Damage { get; private set; }
        public DamageType DamageType { get; private set; }

        public Weapon()
        {
        }

        public Weapon(WeaponId id, string name, WeaponType weaponType)
        {
            Id = id;
            Name = name;
            WeaponType = weaponType;
        }

        public void SetDamage(long damage, DamageType damageType)
        {
            Damage = damage;
            DamageType = damageType;
        }
    }

    public class WeaponFactory
    {
        public static Weapon CreateByProperty(WeaponProperty property)
        {
            var weapon = new Weapon(WeaponId.New, property.Name, property.WeaponType);
            weapon.SetDamage(property.Damage, property.DamageType);
            return weapon;
        }
    }

    public class WeaponProperty
    {
        public string Name { get; set; }
        public WeaponType WeaponType { get; set; }
        public long Damage { get; set; }
        public DamageType DamageType { get; set; }
    }
}